﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DddCms.Infrastructure.Repository;
using System.Data.Entity;
using DddCms.Domain.Model;

namespace DddCms.Infrastructure.Test.Repository
{
    /// <summary>
    /// Mock the DatabaseInitializer class
    /// </summary>
    public class DatabaseInitializerMock : DatabaseInitializer
    {

        /// <summary>
        /// Protected call test methode
        /// </summary>
        /// <param name="database"></param>
        public void fakeSeed(DataContext database)
        {
            this.Seed(database);
        }
    }

    public class DataContextMock : DataContext
    {
        public bool SaveCalled { get; set; }

        public DataContextMock()
            : base()
        {
            SaveCalled = false;
        }
        public override int Save()
        {
            SaveCalled = true;
            return 0;
        }
    }

    public class IDbSetTEntityMock<TEntity> : IDbSet<TEntity> where TEntity : User
    {
        #region NoImplemented
    
        public virtual TEntity Add(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public virtual TEntity Attach(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public virtual TDerivedEntity Create<TDerivedEntity>() where TDerivedEntity : class, TEntity
        {
            throw new NotImplementedException();
        }

        public virtual TEntity Create()
        {
            throw new NotImplementedException();
        }

        public virtual TEntity Find(params object[] keyValues)
        {
            throw new NotImplementedException();
        }

        public virtual System.Collections.ObjectModel.ObservableCollection<TEntity> Local
        {
            get { throw new NotImplementedException(); }
        }

        public virtual TEntity Remove(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public virtual IEnumerator<TEntity> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }

        public virtual Type ElementType
        {
            get { throw new NotImplementedException(); }
        }

        public virtual System.Linq.Expressions.Expression Expression
        {
            get { throw new NotImplementedException(); }
        }

        public virtual IQueryProvider Provider
        {
            get { throw new NotImplementedException(); }
        }
        #endregion
    }

    public class DbSetMock : IDbSetTEntityMock<User>
    {
        public override TOTO Create<TOTO>()
        {
            throw new NotImplementedException();
        }

    }
}
